﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace WindowSwitcher.Behaviors
{
    public class BindingCollection : INotifyPropertyChanged
    {

        private string handleName;
        private System.Windows.Input.Key key;
        private bool enabled;
        private bool attach;
        private IntPtr handle;

        public event PropertyChangedEventHandler PropertyChanged;

        public string HandleName
        {
            get { return this.handleName; }
            set
            {
                if (value != this.handleName)
                {
                    this.handleName = value;
                    NotifyPropertyChanged();
                }
            }
        }
        public System.Windows.Input.Key Key
        {
            get { return this.key; }
            set
            {
                if (value != this.key)
                {
                    this.key = value;
                    NotifyPropertyChanged();
                }
            }
        }

        public bool Enabled
        {
            get { return !this.IsAttached; }
            set { NotifyPropertyChanged(); }
        }

        public bool IsAttached
        {
            get { return this.attach; }
            set
            {
                if (value != this.attach)
                {
                    this.attach = value;
                    NotifyPropertyChanged();
                }
            }
        }

        public IntPtr Handle
        {
            get { return this.handle; }
            set
            {
                if (value != this.handle)
                {
                    this.handle = value;
                    NotifyPropertyChanged();
                }
            }
        }

        private void NotifyPropertyChanged([CallerMemberName] string propertyName = null)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
